
function ImportController( $scope, $rootScope, UploadManager ) {

	$scope.files = [];
	$scope.percentage = 0;
	$scope.import = {fichierSejours : null};

	$rootScope.$on('fileAdded', function (e, call) {
        $scope.files[0] = call;

        $scope.import.fichierSejours = call.name

        $scope.$apply();
    });

	$rootScope.$on('uploadProgress', function (e, call) {
        $scope.percentage = call;
        $scope.$apply();
    });

    $rootScope.$on('uploadDone', function () {
    	alert('TRAITEMENT DONE !!');
    });

    $scope.uploadFileImport = function () {
		if( $scope.import.fichierSejours != "" ) {
        	UploadManager.uploadLast();
		}
    };
}

